package com.java;

import com.java.Controller.StudentCOntroller;
import com.java.View.StudentView;
import com.java.model.Student;

/**
 * Hello world!
 *
 */
public class MvcPatternDemo
{
    public static void main( String[] args )
    {
        //从数据库获取学生记录
        Student model=retriveStudentFromDatabase();

        //创建一个视图：把学生详细信息输出到控制台
        StudentView view=new StudentView();

        StudentCOntroller cOntroller=new StudentCOntroller(model,view);
        cOntroller.updateView();

        //更新模型数据
        cOntroller.setStudentName("John");
        cOntroller.updateView();
    }

    private static  Student retriveStudentFromDatabase(){
        Student student=new Student();
        student.setName("Robert");
        student.setRollNo("10");
        return student;
    }
}
